﻿using System.Collections.Generic;
using System.Linq;

namespace PhysicsProject.Entities.Models
{
    public sealed class Material
    {
        public static readonly Material Aluminum = new Material("Aluminum", 237, MaterialType.Metal);
        public static readonly Material Antimony = new Material("Antimony", 18.5f, MaterialType.Metal);
        public static readonly Material Beryllium = new Material("Beryllium", 218, MaterialType.Metal);
        public static readonly Material Brass = new Material("Brass", 110, MaterialType.Metal);
        public static readonly Material Cadmium = new Material("Cadmium", 92, MaterialType.Metal);
        public static readonly Material Cobalt = new Material("Cobalt", 69, MaterialType.Metal);
        public static readonly Material Constantan = new Material("Constantan", 22, MaterialType.Metal);
        public static readonly Material Copper = new Material("Copper", 398, MaterialType.Metal);
        public static readonly Material Gold = new Material("Gold", 315, MaterialType.Metal);
        public static readonly Material Iridium = new Material("Iridium", 147, MaterialType.Metal);
        public static readonly Material CastIron = new Material("Cast Iron", 55, MaterialType.Metal);
        public static readonly Material PureIron = new Material("Pure Iron", 80.3f, MaterialType.Metal);
        public static readonly Material WroughtIron = new Material("Wrought Iron", 59, MaterialType.Metal);
        public static readonly Material Lead = new Material("Lead", 35.2f, MaterialType.Metal);
        public static readonly Material Magnesium = new Material("Magnesium", 156, MaterialType.Metal);
        public static readonly Material Molybdenum = new Material("Molybdenum", 138, MaterialType.Metal);
        public static readonly Material Monel = new Material("Monel", 26, MaterialType.Metal);
        public static readonly Material Nickel = new Material("Nickel", 90.5f, MaterialType.Metal);
        public static readonly Material Platinum = new Material("Platinum", 73, MaterialType.Metal);
        public static readonly Material Silver = new Material("Silver", 427, MaterialType.Metal);
        public static readonly Material CarbonSteel = new Material("Carbon Steel ", 50, MaterialType.Metal);
        public static readonly Material StainlessSteel = new Material("Stainless Steel", 25, MaterialType.Metal);
        public static readonly Material Tin = new Material("Tin", 67, MaterialType.Metal);
        public static readonly Material Zinc = new Material("Zinc", 113, MaterialType.Metal);
        public static readonly Material Acrylic = new Material("Acrylic", 0.2f, MaterialType.Plastic);
        public static readonly Material NylonSix = new Material("Nylon 6", 0.25f, MaterialType.Plastic);
        public static readonly Material Polythene = new Material("Polythene (HDPE)", 0.5f, MaterialType.Plastic);
        public static readonly Material Polytetrafluoroethylene = new Material("Polytetrafluoroethylene (PTFE)", 0.25f, MaterialType.Plastic);
        public static readonly Material PolyvinylChloride = new Material("Polyvinyl Chloride (PVC)", 0.19f, MaterialType.Plastic);
        public static readonly Material Asphalt = new Material("Asphalt", 1.26f, MaterialType.OtherSolid);
        public static readonly Material Bitumen = new Material("Bitumen", 0.17f, MaterialType.OtherSolid);
        public static readonly Material BreezeBlock = new Material("Breeze Block", 0.15f, MaterialType.OtherSolid);
        public static readonly Material Brickwork = new Material("Brickwork", 0.6f, MaterialType.OtherSolid);
        public static readonly Material DenseBrick = new Material("Brick - Dense", 1.6f, MaterialType.OtherSolid);
        public static readonly Material Carbon = new Material("Carbon", 0.17f, MaterialType.OtherSolid);
        public static readonly Material LowDensityConcrete = new Material("Concrete (Low Density)", 0.2f, MaterialType.OtherSolid);
        public static readonly Material MediumDensityConcrete = new Material("Concrete (Medium Density)", 0.5f, MaterialType.OtherSolid);
        public static readonly Material HighDensityConcrete = new Material("Concrete (High Density)", 1.5f, MaterialType.OtherSolid);
        public static readonly Material Firebrick = new Material("Firebrick", 1.09f, MaterialType.OtherSolid);
        public static readonly Material Glass = new Material("Glass", 1.05f, MaterialType.OtherSolid);
        public static readonly Material BorosilicateGlass = new Material("Glass - Borosilicate", 1.3f, MaterialType.OtherSolid);
        public static readonly Material Ice = new Material("Ice", 2.18f, MaterialType.OtherSolid);
        public static readonly Material Limestone = new Material("Limestone", 1.1f, MaterialType.OtherSolid);
        public static readonly Material Mica = new Material("Mica", 0.75f, MaterialType.OtherSolid);
        public static readonly Material Cement = new Material("Cement", 1.01f, MaterialType.OtherSolid);
        public static readonly Material ParafinWax = new Material("Parafin Wax", 0.25f, MaterialType.OtherSolid);
        public static readonly Material Porcelain = new Material("Porcelain", 1.05f, MaterialType.OtherSolid);
        public static readonly Material Sand = new Material("Sand", 0.06f, MaterialType.OtherSolid);
        public static readonly Material Balsa = new Material("Balsa", 0.048f, MaterialType.Insulation);
        public static readonly Material ComposedStraw = new Material("Straw - Composed", 0.09f, MaterialType.Insulation);
        public static readonly Material CottonWool = new Material("Cotton Wool", 0.029f, MaterialType.Insulation);
        public static readonly Material ExpandedPolystyrene = new Material("Polystyrene - Expanded ", 0.03f, MaterialType.Insulation);
        public static readonly Material Felt = new Material("Felt", 0.04f, MaterialType.Insulation);
        public static readonly Material GlassWool = new Material("Glass Wool", 0.040f, MaterialType.Insulation);
        public static readonly Material Kapok = new Material("Kapok", 0.034f, MaterialType.Insulation);
        public static readonly Material Magnesia = new Material("Magnesia", 0.07f, MaterialType.Insulation);
        public static readonly Material Plywood = new Material("Plywood", 0.13f, MaterialType.Insulation);
        public static readonly Material RockWool = new Material("Rock Wool", 0.045f, MaterialType.Insulation);
        public static readonly Material Sawdust = new Material("Sawdust", 0.06f, MaterialType.Insulation);
        public static readonly Material SlagWool = new Material("Slag Wool", 0.042f, MaterialType.Insulation);
        public static readonly Material Wood = new Material("Wood", 0.13f, MaterialType.Insulation);
        public static readonly Material SheepWool = new Material("Sheep's Wool", 0.038f, MaterialType.Insulation);
        public static readonly Material Cellulose = new Material("Cellulose", 0.039f, MaterialType.Insulation);
        public static readonly Material Benzene = new Material("Benzene", 0.16f, MaterialType.Liquid);
        public static readonly Material CarbTetIde = new Material("Carb Tet'ide", 0.11f, MaterialType.Liquid);
        public static readonly Material Acetone = new Material("Acetone", 0.16f, MaterialType.Liquid);
        public static readonly Material Ether = new Material("Ether", 0.14f, MaterialType.Liquid);
        public static readonly Material Glycerol = new Material("Glycerol", 0.28f, MaterialType.Liquid);
        public static readonly Material Kerosene = new Material("Kerosene", 0.15f, MaterialType.Liquid);
        public static readonly Material Mercury = new Material("Mercury", 8f, MaterialType.Liquid);
        public static readonly Material Methanol = new Material("Methanol", 0.21f, MaterialType.Liquid);
        public static readonly Material MachineOil = new Material("Machine Oil", 0.15f, MaterialType.Liquid);
        public static readonly Material Water = new Material("Water", 0.58f, MaterialType.Liquid);
        public static readonly Material Sodium = new Material("Sodium", 84, MaterialType.Liquid);
        public static readonly Material Air = new Material("Air", 0.024f, MaterialType.Gas);
        public static readonly Material Ammonia = new Material("Ammonia", 0.022f, MaterialType.Gas);
        public static readonly Material Argon = new Material("Argon", 0.016f, MaterialType.Gas);
        public static readonly Material CarbonDioxide = new Material("Carbon Dioxide", 0.015f, MaterialType.Gas);
        public static readonly Material CarbonMonoxide = new Material("Carbon Monoixide", 0.023f, MaterialType.Gas);
        public static readonly Material Helium = new Material("Helium", 0.142f, MaterialType.Gas);
        public static readonly Material Hydrogen = new Material("Hydrogen", 0.168f, MaterialType.Gas);
        public static readonly Material Methane = new Material("Methane", 0.030f, MaterialType.Gas);
        public static readonly Material Nitrogen = new Material("Nitrogen", 0.024f, MaterialType.Gas);
        public static readonly Material Oxygen = new Material("Oxygen", 0.024f, MaterialType.Gas);
        public static readonly Material WaterVapor = new Material("Water Vapor", 0.016f, MaterialType.Gas);

        private static readonly List<Material> MaterialsList;

        public string Name { get; private set; }

        public float Coefficient { get; private set; }

        public MaterialType MaterialType { get; private set; }

        static Material()
        {
            MaterialsList = new List<Material>();
        }

        public Material(string name, float coefficient, MaterialType type)
        {
            Name = name;
            Coefficient = coefficient;
            MaterialType = type;
            MaterialsList.Add(this);
        }

        public static IEnumerable<Material> GetAllMaterials()
        {
            return MaterialsList.AsEnumerable();
        }

        public static IEnumerable<Material> GetMeterialsByType(MaterialType type)
        {
            return MaterialsList.Where(m => (m.MaterialType & type) > 0x0).AsEnumerable();
        }
    }
}
